package com.umfb.timertask.jobs;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * Created by zcah on 18-6-12.
 */
@Component
public class Task {

    @Scheduled(cron = "0 0/1 * * * ?")
    public void task01() throws InterruptedException{
        System.out.println(Thread.currentThread().getName()+"---------------------task01");
        TimeUnit.SECONDS.sleep(2);
    }

    @Scheduled(cron = "0 0/1 * * * ?")
    public void task02() throws InterruptedException{
        System.out.println(Thread.currentThread().getName()+"---------------------task02");
    }

    @Scheduled(cron = "0 0/1 * * * ?")
    public void task03() throws InterruptedException{
        System.out.println(Thread.currentThread().getName()+"---------------------task03");
    }
}
